<include file="public@storage"/>
</head>
<body>
<div class="container body-content" style="margin-top:20px;width: 100%">
    <div class="panel panel-info" style="margin-bottom: 0.5rem">

        <div class="panel-heading">

            投料单
        </div>


        <div class="col-lg-offset-10" id="tips"> <span class="label label-default" style="">点击该按钮下载excel ↓</span></div>

        <input type="hidden" id="bomUuid" value="{$bomUuid}">
        <input type="hidden" id="returnValue" value="{$history}">
        <div class="panel-body">
            <div class="row">
                <div class="col-sm-12">

                    <div id="toolbar" class="btn-group">

                        <button class="btn btn-info" style="margin-left: 5px;width: 8rem" onclick="printArea()">打印
                        </button>
                        &nbsp;&nbsp;

                    </div>

                    <table id="table" data-toggle="main-grid-print" class="table table-condensed"></table>
                    <div class="preview" id="preview" style='display: none;'>
                        <div id="printAll">
                            <table id="printContent" border="solid 1 black"
                                   style="margin:0 auto;padding: 0;font-size:8px;text-align: center;display: none;"></table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script src="__STATIC__/storage/print/printThis.js"></script>
<script src="__STATIC__/storage/js/storage/car_list.js"></script>
<script src="__STATIC__\js\bootstrap_table_export\bootstrap-table-export.js"></script>
<script src="__STATIC__\js\bootstrap_table_export\tableExport.js"></script>


<script>
    var bomTitle = '';
    var proCode = '';

    $(function () {
        var url = "{:url('/storage/Bom/getListTitle')}";
        var param = {bomUuid: $('#bomUuid').val()};
        var success = function (ret) {
            bomTitle = ret['bom'];
            proCode = ret['product'];
            init();
        };
        ajax('get', url, param, success);
    });


    function init() {
        var bomUuid = $('#bomUuid').val();
        var url = "{:url('storage/Bom/getCarList')}?bomUuid=" + bomUuid;
        var columns = [
            [
                {
                    title: '投料单', align: "center", colspan: 11
                }
            ],
            [
                {
                    title: '单号', width: 50, align: "center"
                },
                {
                    title: bomTitle,
                    align: "center",
                    colspan: 6
                },
                {
                    title: "产品代码",
                    align: "center"
                },
                {
                    title: proCode,
                    halign: "center",
                    align: "center",
                    colspan: 3
                }
            ], [
                {
                    title: '序号', width: 50, align: "center", formatter: function (value, row, index) {
                        return index + 1;
                    }
                },
                {title: '物料号', field: 'sub_materiel_id', align: "center", width: 300},
                {title: '计划', field: 'originalCount', align: "center", width: 100},
                {title: '用量', field: 'measure', align: "center", width: 50},
                {title: '始发', field: 'oughtCount', align: "center", width: 100},
                {title: '补发', field: 'secondCount', align: "center", width: 100},
                {title: '盘数', field: 'plateNumber', align: "center", width: 80},
                {title: '小车', field: 'carCode', align: "center", width: 150},
                {title: '站位', field: 'seatCode', align: "center"},
                {title: '退料', field: 'backCount', align: "center", width: 150},
                {title: '备注', field: 'remark', align: "center", width: 150}
            ]];
        initTable(url, columns, 'client', false);
        $('#table').bootstrapTable('togglePagination');
        // $('#table').addClass("table table-condensed");
    }


    printArea = function () {
        printCarList(bomTitle, proCode);
    };

</script>
</html>